<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
    <style>
        div {
            padding: 20px;
            border: 1px solid #000;
            position: relative;
        }

        main {
            height: 1000px;
        }
    </style>
</head>

<body>
    <div>
        <a href="">这是a</a>
    </div>
    <main></main>
    <script>
        var w = $('a').width();
        console.log($('div').width()); // content
        console.log($('div').innerWidth());  // content+padding
        console.log($('div').outerWidth()); // content + padding+border 

        // 获取到文档的距离
        console.log($('a').offset());

        // 获取到最近的设置有非静态定位属性的父级标签
        console.log($('a').position());


        
         

    </script>
</body>

</html>